package com.wx.app.mylib.utils;

import android.util.Log;

/**Created by Administrator on 2016/6/1.
 */
public class LogUtil {

    public LogUtil() {
    }

    public static final String Tag = "===Smile 36999 Print===";
    public static String Cname = "";
    public static String Mname = "";

    protected static void getTrace() {
        StackTraceElement caller = (new Throwable()).fillInStackTrace().getStackTrace()[2];
        String className = caller.getClassName();
        className = className.substring(className.lastIndexOf(".") + 1);
        Cname = className;
        Mname = caller.getMethodName() + "->" + caller.getLineNumber() + ": ";
    }

    public static void e(String text) {
        getTrace();
        if (null == text) {
            text = "null";
        }
        Log.e(Tag, Cname + "->" + Mname + text);
    }

    public static void d(String text) {
        getTrace();
        if (null == text) {
            text = "null";
        }
        Log.d(Tag, Cname + "->" + Mname + text);
    }

    public static void i(String text) {
        getTrace();
        if (null == text) {
            text = "null";
        }
        Log.i(Tag, Cname + "->" + Mname + text);
    }
}
